import logging
from redis import StrictRedis


class Config(object):
    SECRET_KEY ='Zj8qkEtSULMCXBwhuoMpBPC+Czxu/A93F3AD4HDdp4EVByjL6yCaiNY+z03RzGeP4U5jIAjUwm9+LklO59Og5A=='

    DEBUG =True

    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/flaskinfo1'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    REDIS_HOST ='127.0.0.1'
    REDIS_PORT ='6379'

    #设置session
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    SESSION_PERMANET =False
    PERMANET_SESSION_LIVETIME = 86400*2

    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

class DevelopmentConfig(Config):
    DEBUG =True
    LOG_LEVEL = logging.DEBUG
class ProductionConfig(Config):
    DEBUG =False
    LOG_LEVEL = logging.WARNING
class TestingConfig(Config):
    TESTING =True
    LOG_LEVEL = logging.DEBUG
config ={
    'DevelopmentConfig':DevelopmentConfig,
    'ProductionConfig':ProductionConfig,
    'TestingConfig':TestingConfig
    }